﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////

#pragma once
#include <string>
#include "GcmpJournalInterface.h"
#include "OwnerPtr.h"

#pragma warning (disable: 4251)


namespace gcmp
{
    /// \brief 日志验证器接口
    class GCMP_JOURNAL_INTERFACE_EXPORT IJournalValidator
    {
    public:

        IJournalValidator();

        virtual ~IJournalValidator();
        
        /// \brief 获取验证器的名字
        ///
        /// \return 验证器的名字
        virtual std::wstring GetName() const = 0;

        /// \brief 获取验证器的用途描述
        ///
        /// \return 验证器的用途描述
        virtual std::wstring GetDescription() const = 0;
        
        /// \brief 设置验证器的参数
        ///
        /// \param[in] inputParamString 验证器参数的输入字符串
        virtual void SetValidatorInput(const std::wstring& inputParamString) = 0;

        /// \brief 获取验证器的参数
        ///
        /// \return 验证器的参数
        virtual std::wstring GetValidatorInput() const = 0;

        /// \brief 产生验证器要用于比较的具体验证内容
        ///
        /// \param[in] filePath 验证器输出文件的路经
        /// \return 运行结果，true成功，false失败
        virtual bool GenerateOutputResult(const std::wstring& filePath) = 0;
        
        /// \brief 提供验证器用于比较两个输入文件的实现
        ///
        /// \param[in] baselinePath 验证器录制时产生的基线文件的路经
        /// \param[in] resultPath 验证器回放时产生的输出文件的路经
       /// \param[out] errorMsg 验证器比较下来结果不同时，提示的错误信息
        /// \return 运行结果，true比较结果相同，false比较结果不同
        virtual bool Compare(const std::wstring& baselinePath, const std::wstring& resultPath, std::wstring& errorMsg) = 0;

    
    };

}


#define REGISTER_TEST_VALIDATOR(CLASS_NAME) \
      static OwnerPtr<IJournalValidator> s_JournalValidator = NEW_AS_OWNER_PTR(CLASS_NAME);
      